package collection.arrryList;

import java.lang.reflect.Field;
import java.util.Arrays;

public class array {
    public static void main(String[] args) throws NoSuchFieldException {
        Class<stu> stuClass = stu.class;
        Field name = stuClass.getDeclaredField("name");
        System.out.println("name = " + name);
        name.setAccessible(true);
        System.out.println("name = " + name);

        Field name1 = stuClass.getField("age");
        name1.setAccessible(true);
        System.out.println("name1 = " + name1);


        Field[] fields = stuClass.getFields();
        for (Field field : fields) {
            field.setAccessible(true);
        }
        System.out.println("Arrays.toString(fields) = " + Arrays.toString(fields));
    }

}

class stu{
    private String name = "skl";
    public Integer age = 20;
}


